﻿<?php 
require_once("../public_files/conn.php");
require_once("../public_files/fenye.php");
	$type=$_POST['type'];		//官方or用户
	$listname_id=$_POST['listname_id'];		///获得分类ID
	$pagenum_comment=$_POST['pagenum_comment'];



	if($type==0){
	$table9="official_list_comment";
	
	}else{
	$table9="user_list_comment";

	}
				$page_comment=isset($_POST['page_comment'])?intval($_POST['page_comment']):1;
				$num_comment=8;
				$sqll="select * from ".$table9." where list_id='$listname_id' order by comment_time desc";
				$total_comment=mysql_num_rows(mysql_query($sqll));	
				$pagenum_comment=ceil($total_comment/$num_comment);	
				If($page_comment>$pagenum_comment || $page_comment == 0){
						echo "error : Can Not Found The page .";
						exit;
				}
				$offset_comment=($page_comment-1)*$num_comment;//从第几页开始从数据库取数据
				
				$resultt=mysql_query("select * from ".$table9." where list_id='$listname_id' order by comment_time desc limit $offset_comment ,$num_comment")or die(mysql_error());
					while($roww=mysql_fetch_array($resultt)){
					if($roww['user_id']==0){
						$comment_name="游客";
					}else{
						$sqq="select * from userinf where id='$roww[user_id]'";
						$resulttt=mysql_query($sqq);
						$comment=mysql_fetch_array($resulttt)or die(mysql_error());
						$comment_name=$comment['username'];
					}
					?>
					
					<div class="message_show_1">
																													<!--用户头像-->
								<div class="user_photo_1">
									<img src="../images/user_photo.gif"/>
								</div>
																													<!--用户昵称-->
								<div class="user_name_1">
									<a href="#" style="color:#79C3F0;font-size:15px;"><?php echo $comment_name; ?></a>
									&nbsp;&nbsp;&nbsp;&nbsp;<a style="color:#8996A0;font-size:11px;"><?php echo $roww['comment_time'] ?></a>
								</div>
																													<!--用户留言内容-->
								<div class="message_show_content"style="width:600px;">
									<p><?php echo $roww['content'] ?></p>								
								</div>
							</div>
							
			
				<?php 
					}
			echo '<div class="feiye">';
				fenyexianshi($page_comment,$pagenum_comment,$type,"comment_fenye",$listname_id," -5","-5 ");////////////////逻辑分页、分块
			echo '</div>'; 




?>